package com.wjv.example.spbt.mybatis.mapper;

import com.wjv.example.spbt.mybatis.entity.FilmmakerEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.jdbc.SQL;

/**
 * <p>Title: FilmmakerMapper</p>
 *
 * @author wjv
 * @date 2021/4/9 10:39
 * @description
 */
@Mapper
public interface FilmmakerMapper {


    @Select(value = "select * from filmmaker where id = #{id} limit 1")
    FilmmakerEntity queryById(int id);


    @SelectProvider(type = SqlProvider.class, method = "selectById")
    FilmmakerEntity queryById2(int id);



    public static class SqlProvider {
        public static String selectById() {
            return "select * from filmmaker where id = #{id} limit 1";
        }

        public static String save() {
            return new SQL() {{
                INSERT_INTO("");
                VALUES("", "");
            }}.toString();
        }
    }
}
